package com.itcast.peft.controller;

import java.io.IOException;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.itcast.peft.service.HealthPDFGenerator;
import com.itcast.peft.service.HealthReportAnalyzer;

@RestController
@RequestMapping("/health")
public class HealthController {

    @Autowired
    private HealthPDFGenerator healthPDFGenerator;
    
    @Autowired
    private HealthReportAnalyzer healthReportAnalyzer;
    

    @GetMapping("/generatePDF")
    @ResponseBody
    public String generatePDF() throws IOException {
        healthPDFGenerator.generatePDF();
        return "success";
    }
    
    @GetMapping("/generateQuestionByPDF")
    @ResponseBody
    public String generateQuestionByPDF() throws IOException {
        healthReportAnalyzer.generateQuestionByPDF();
        return "success";
    }
    

}
